namespace EntLibEC.View.Cmn
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;
	using System.Collections;

	using EntLibEC.Cmn;
	using EntLibEC.Info.Basic;
	using EntLibEC.Biz.Basic;

	/// <summary>
	///		Summary description for Category1.
	/// </summary>
	public partial class Category1 : System.Web.UI.UserControl
	{

		protected void Page_Load(object sender, System.EventArgs e)
		{
			// Put user code to initialize the page here
		}

		public void BindC1(bool isAll)
		{
			ddlC1.Items.Clear();
			SortedList sl = CategoryManager.GetInstance().GetC1List();
			if ( sl != null && sl.Count != 0 )
			{
				foreach(Category1Info item in sl.Keys)
				{
					ddlC1.Items.Add(
						new ListItem(item.ToString(), item.SysNo.ToString()) );
				}
			}
			if ( isAll )
				ddlC1.Items.Insert(0, new ListItem( AppConst.AllSelectString, AppConst.IntNull.ToString() ));
		}
		public int C1SysNo
		{
			get
			{
				try
				{
					return Convert.ToInt32(ddlC1.SelectedItem.Value);
				}
				catch
				{
					return AppConst.IntNull;
				}
			}
			set
			{
				ddlC1.SelectedIndex = ddlC1.Items.IndexOf( ddlC1.Items.FindByValue(value.ToString() ) );
			}
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		///		Required method for Designer support - do not modify
		///		the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{

		}
		#endregion
	}
}
